package com.softlab.retailwholesalesystem.controller;

import com.softlab.retailwholesalesystem.entity.MenuEntity;
import com.softlab.retailwholesalesystem.service.IMenuService;
import com.softlab.retailwholesalesystem.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController extends BaseController{

    @Autowired
    IMenuService service;

    @GetMapping("{authorId}")
    public JsonResult<List<MenuEntity>> getMenuByAuthority(@PathVariable Integer authorId){
        List<MenuEntity> menu = service.getMenuByAuthority(authorId);
        return new JsonResult<>(200,"获得菜单成功",menu);
    }

}
